# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'Acl'
        db.create_table('dns_acl', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('type', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
            ('key', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
        ))
        db.send_create_signal('dns', ['Acl'])

        # Adding model 'Cryptokey'
        db.create_table('dns_cryptokey', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('domain', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['dns.Domain'])),
            ('flags', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('active', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('content', self.gf('django.db.models.fields.CharField')(max_length=4096)),
        ))
        db.send_create_signal('dns', ['Cryptokey'])

        # Adding model 'Domainmetadata'
        db.create_table('dns_domainmetadata', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('domain', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['dns.Domain'])),
            ('kind', self.gf('django.db.models.fields.CharField')(max_length=4096)),
            ('content', self.gf('django.db.models.fields.CharField')(max_length=4096)),
        ))
        db.send_create_signal('dns', ['Domainmetadata'])

        # Adding model 'Nameserver'
        db.create_table('dns_nameserver', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
            ('ip', self.gf('django.db.models.fields.IPAddressField')(max_length=15)),
            ('ipv6', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
        ))
        db.send_create_signal('dns', ['Nameserver'])

        # Adding model 'Supermaster'
        db.create_table('dns_supermaster', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('ip', self.gf('django.db.models.fields.IPAddressField')(unique=True, max_length=15)),
            ('nameserver', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
            ('account', self.gf('django.db.models.fields.CharField')(max_length=40, blank=True)),
        ))
        db.send_create_signal('dns', ['Supermaster'])

        # Adding model 'Domain'
        db.create_table('dns_domain', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
            ('master', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
            ('last_check', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('type', self.gf('django.db.models.fields.CharField')(default='Native', max_length=6)),
            ('notified_serial', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('account', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
            ('serial', self.gf('django.db.models.fields.IntegerField')(default='2011012401')),
            ('default_ttl', self.gf('django.db.models.fields.IntegerField')(default=86400)),
            ('refresh_ttl', self.gf('django.db.models.fields.IntegerField')(default=28800)),
            ('retry_ttl', self.gf('django.db.models.fields.IntegerField')(default=14400)),
            ('expire_ttl', self.gf('django.db.models.fields.IntegerField')(default=3600000)),
            ('minimum_ttl', self.gf('django.db.models.fields.IntegerField')(default=86400)),
            ('soa_nameserver', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('admin_mailbox', self.gf('django.db.models.fields.EmailField')(max_length=75)),
            ('allow_users', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('description', self.gf('django.db.models.fields.CharField')(max_length=4096, null=True, blank=True)),
        ))
        db.send_create_signal('dns', ['Domain'])

        # Adding M2M table for field nameservers on 'Domain'
        db.create_table('dns_domain_nameservers', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('domain', models.ForeignKey(orm['dns.domain'], null=False)),
            ('nameserver', models.ForeignKey(orm['dns.nameserver'], null=False))
        ))
        db.create_unique('dns_domain_nameservers', ['domain_id', 'nameserver_id'])

        # Adding model 'Record'
        db.create_table('dns_record', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('domain', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['dns.Domain'])),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('type', self.gf('django.db.models.fields.CharField')(default='A', max_length=6)),
            ('content', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('ttl', self.gf('django.db.models.fields.IntegerField')(default=3600, blank=True)),
            ('prio', self.gf('django.db.models.fields.IntegerField')(default=0, blank=True)),
            ('description', self.gf('django.db.models.fields.CharField')(max_length=4096, null=True, blank=True)),
            ('dynamic', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('auth', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('ordername', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=255, blank=True)),
        ))
        db.send_create_signal('dns', ['Record'])


    def backwards(self, orm):
        
        # Deleting model 'Acl'
        db.delete_table('dns_acl')

        # Deleting model 'Cryptokey'
        db.delete_table('dns_cryptokey')

        # Deleting model 'Domainmetadata'
        db.delete_table('dns_domainmetadata')

        # Deleting model 'Nameserver'
        db.delete_table('dns_nameserver')

        # Deleting model 'Supermaster'
        db.delete_table('dns_supermaster')

        # Deleting model 'Domain'
        db.delete_table('dns_domain')

        # Removing M2M table for field nameservers on 'Domain'
        db.delete_table('dns_domain_nameservers')

        # Deleting model 'Record'
        db.delete_table('dns_record')


    models = {
        'dns.acl': {
            'Meta': {'ordering': "['key']", 'object_name': 'Acl'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
            'type': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        },
        'dns.cryptokey': {
            'Meta': {'ordering': "['id']", 'object_name': 'Cryptokey'},
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'content': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
            'domain': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dns.Domain']"}),
            'flags': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        'dns.domain': {
            'Meta': {'ordering': "['id']", 'object_name': 'Domain'},
            'account': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            'admin_mailbox': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
            'allow_users': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'default_ttl': ('django.db.models.fields.IntegerField', [], {'default': '86400'}),
            'description': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True', 'blank': 'True'}),
            'expire_ttl': ('django.db.models.fields.IntegerField', [], {'default': '3600000'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'last_check': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'master': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
            'minimum_ttl': ('django.db.models.fields.IntegerField', [], {'default': '86400'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
            'nameservers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['dns.Nameserver']", 'symmetrical': 'False'}),
            'notified_serial': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'refresh_ttl': ('django.db.models.fields.IntegerField', [], {'default': '28800'}),
            'retry_ttl': ('django.db.models.fields.IntegerField', [], {'default': '14400'}),
            'serial': ('django.db.models.fields.IntegerField', [], {'default': "'2011012401'"}),
            'soa_nameserver': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'type': ('django.db.models.fields.CharField', [], {'default': "'Native'", 'max_length': '6'})
        },
        'dns.domainmetadata': {
            'Meta': {'ordering': "['id']", 'object_name': 'Domainmetadata'},
            'content': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
            'domain': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dns.Domain']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'kind': ('django.db.models.fields.CharField', [], {'max_length': '4096'})
        },
        'dns.nameserver': {
            'Meta': {'ordering': "['name']", 'object_name': 'Nameserver'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
            'ipv6': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        },
        'dns.record': {
            'Meta': {'ordering': "['-id', 'name', 'type']", 'object_name': 'Record'},
            'auth': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'content': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'description': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True', 'blank': 'True'}),
            'domain': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['dns.Domain']"}),
            'dynamic': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'ordername': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
            'prio': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
            'ttl': ('django.db.models.fields.IntegerField', [], {'default': '3600', 'blank': 'True'}),
            'type': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '6'})
        },
        'dns.supermaster': {
            'Meta': {'ordering': "['nameserver']", 'object_name': 'Supermaster'},
            'account': ('django.db.models.fields.CharField', [], {'max_length': '40', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ip': ('django.db.models.fields.IPAddressField', [], {'unique': 'True', 'max_length': '15'}),
            'nameserver': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
        }
    }

    complete_apps = ['dns']
